﻿using AutoMapper;
using TrackSystem.Entities.Dtos.Channel;
using TrackSystem.Entities.Dtos.Equip;
using TrackSystem.Entities.Dtos.Logic;
using TrackSystem.Entities.Dtos.Loop;
using TrackSystem.Entities.Dtos.Sensor;
using TrackSystem.Entities.Dtos.Slave;
using TrackSystem.Entities.Dtos.User;
using TrackSystem.Entities.Dtos.Var;
using TrackSystem.Entities.Models;
using TrackSystem.IO.Alarm;
using TrackSystem.IO.Models;
using TrackSystem.IO.Ports;


namespace TrackSystem.API
{
    /// <summary>
    /// 映射类定义
    /// </summary>
    public class MappingProfile : Profile
    {
        /// <summary>
        /// 映射定义
        /// </summary>
        public MappingProfile()
        {
            CreateMap<EquipTable, EquipDto>();
            CreateMap<EquipTable, EquipWithSensorsDto>();
            CreateMap<EquipDto, EquipTable>();

            CreateMap<ChannelTable, ChannelDto>();
            CreateMap<ChannelTable, ChannelWithSensorsDto>();
            CreateMap<ChnTCPForCreateDto, ChannelTable>();
            CreateMap<ChnUDPForCreateDto, ChannelTable>();
            CreateMap<ChnSerialForCreateDto, ChannelTable>();
            CreateMap<ChannelDto, ChannelTable>();

            CreateMap<SensorTable, SensorDto>();
            CreateMap<SensorTable, SensorWithChannelDto>();
            CreateMap<SensorForCreatedDto, SensorTable>();
            CreateMap<SensorForUpdateDto, SensorTable>();

            CreateMap<VarTable, VarDto>();
            CreateMap<VarDto, VarTable>();

            CreateMap<LogicTable, LogicDto>();
            CreateMap<LogicForCreateDto, LogicTable>();
            CreateMap<LogicForUpdateDto, LogicTable>();
            CreateMap<LogicDto, LogicTable>();
            CreateMap<LogicTable, LogicForUpdateDto>();

            CreateMap<LoopTable, LoopDto>();
            CreateMap<LoopDto, LoopTable>();
            CreateMap<LoopTable, LoopForUpdateDto>();

            CreateMap<UserForCreateDto, User>();
            CreateMap<User, UserDto>();

            CreateMap<PortItem, IOUnit>();
            CreateMap<AlarmTable, AlarmItem>();
            CreateMap<AlarmItem, AlarmTable>();

            CreateMap<SlaveTable, SlaveDto>();
            CreateMap<SlaveDto, SlaveTable>();
        }
    }
}
